<!--
 * @Author: xuwejie 1529315455@qq.com
 * @Date: 2023-12-01 09:59:22
 * @LastEditors: xuwejie 1529315455@qq.com
 * @LastEditTime: 2023-12-01 14:07:11
 * @FilePath: \school-shop-vue\pages\user\userInfo.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <view class="page">
    <hx-navbar ref="hxnb" :config="config" @clickBtn="Btn" />

    <view class="content">
      <view
        class="content-box flex-row-between"
        v-for="(item, index) in userInfoList"
        :key="index"
      >
        <span class="title">{{ item.name }}</span>
        <view class="image" v-if="item.type == 'img'">
          <image :src="item.icon"></image>
        </view>
        <span class="title" :style="{ color: item.color }" v-else>{{
          item.right
        }}</span>
      </view>
    </view>

    <view
      class="content flex-row-between"
      style="padding: 35rpx 30rpx; align-items: center"
      @click="changeAddress"
    >
      <view class="content-left flex-column-start">
        <div class="content-left-user">
          <span class="userName">吴杨</span>
          <span class="userPhone">15800000000</span>
        </div>
        <span class="userAddress">南昌市红谷滩卫东新村西区20号楼2单元301</span>
      </view>
      <u-icon name="edit-pen" color="#999999"></u-icon>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      config: {
        title: "个人信息",
        color: "#333333",
        //背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
        backgroundColor: [1, ["#ffffff", "#ffffff"]],
        // 滑动屏幕后切换颜色，注意颜色为数组时长度必须一样，还有使用滑动切换必须监听 onPageScroll 事件
        slideBackgroundColor: [0, ["#ffffff", "#ffffff"]],
        // 状态栏 ，数组则为滑动变色
        statusBarBackground: ["", "#ffffff"],
      },
      userInfoList: [
        {
          name: "头像",
          type: "img",
          icon: "../../static/image/shop-img.png",
        },
        {
          name: "昵称",
          type: "span",
          right: "菜东家",
          color: "#333333",
        },
        {
          name: "ID",
          type: "span",
          right: "88888888",
          color: "#CCCCCC",
        },
        {
          name: "联系电话",
          type: "span",
          right: "1500000000000",
          color: "#333333",
        },
        {
          name: "登录密码",
          type: "span",
          right: "123123",
          color: "#333333",
        },
      ],
    };
  },
  methods: {
    // 跳转到修改地址页面
    changeAddress() {
      uni.navigateTo({
        url: "/pages/user/change/edit_address",
      });
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/static/scss/index.scss";
.page {
  width: 100%;
  background: #f8f9fa;
  height: 100vh;
  .content {
    width: calc(100% - 40rpx);
    background: #fff;
    margin: 20rpx auto;
    padding: 20rpx 30rpx;
    border-radius: 20rpx;

    &-box {
      width: 100%;
      align-items: center;
      height: 110rpx;
      border-bottom: 1rpx solid #ececec;
      &:nth-last-child(1) {
        border-bottom: none;
      }
      .title {
        font-size: 30rpx;
        font-family: PingFang SC;
        font-weight: bold;
      }
      .image {
        width: 80rpx;
        height: 80rpx;
        /deep/uni-image {
          width: 100%;
          height: 100%;
        }
      }
    }

    &-left {
      width: calc(100% - 100rpx);
      &-user {
        font-size: 30rpx;
        font-family: PingFang SC;
        font-weight: bold;
        .userName {
          color: #333333;
        }
        .userPhone {
          margin-left: 20rpx;
          color: #262424;
        }
      }
      .userAddress {
        font-size: 26rpx;
        font-family: PingFang SC;
        font-weight: 500;
        color: #666262;
        margin-top: 10rpx;
      }
    }
  }
}

/deep/.hx_font_size {
  font-weight: bold;
}
</style>